package com.nie.token_bucket.config;

import com.nie.token_bucket.Interceptor.TokenBucketInterceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import javax.annotation.Resource;

/**
 * mvc配置
 *
 * @author nie_cq
 * @date 2022/10/29
 */
@Component
public class MvcConfig extends WebMvcConfigurationSupport {
    @Resource
    private TokenBucketInterceptor tokenBucketInterceptor;
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenBucketInterceptor)
                .addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
